package cn.ruihusoft.ql.core;

import cn.hutool.core.util.StrUtil;
import cn.ruihusoft.ql.pojo.Response;
import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.interceptor.Interceptor;

public class ResponseInterceptor implements Interceptor<Response> {

    @Override
    public void onSuccess(Response data, ForestRequest request, ForestResponse response) {
        if (!data.isSuccess()) {
            throw new RuntimeException(StrUtil.format("接口失败：{}-{}", data.getCode(), data.getMessage()));
        }
    }

}
